package com.bdqn.service;

import com.bdqn.dao.SysUserMapper;
import com.bdqn.pojo.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("sysUserService")  //注册一个Service层的Bean
public class SysUserServiceImpl implements SysUserService{
    @Autowired  //@Resource//使用注解的方式将DAO层的Bean注入
    private SysUserMapper sysUserMapper;
    @Override
    public List<SysUser> getList(SysUser sysUser) {
        try {
            return sysUserMapper.selectSysUserList(sysUser);
        }catch (RuntimeException e){
            e.printStackTrace();
            throw e;
        }
    }

    @Override
    public boolean add(SysUser sysUser) {
        sysUserMapper.add(sysUser);
        return true;
    }

    @Override
    public int delete(SysUser sysUser) {
        return sysUserMapper.delete(sysUser);
    }

    public void setSysUserMapper(SysUserMapper sysUserMapper) {
        this.sysUserMapper = sysUserMapper;
    }
}
